package xw4g08;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

public class Configuration {
	public static final File BASE_DIR = new File("temp").getAbsoluteFile();
	static final int EVEN = 0;//distribution type
	static final int GAUSSIAN = 1;
	public static final File OUT_DIR = new File(BASE_DIR, "output");
	/**
	 * BASE_DIR,"input"
	 */
	public static File IN_DIR = new File(BASE_DIR,"input");
	public static File STA_OUT = new File(BASE_DIR, "stats");
	public static int REP_NUM;
	public static List<String> REP_URLs = new LinkedList<String>();

	public static void init(){
		readConf();
	}
	
	private static void readConf(){
		readConf("temp"+File.separator+"config.ini");
	}
	
	private static void readConf(String conf){
		
		File file = new File(conf);
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new FileReader(file));
	        String tempString = null;
	        while ((tempString = reader.readLine()) != null) {
	        	if(tempString.startsWith("#"))
	        		continue;
	        	REP_URLs.add(tempString);
	        }
	        reader.close();
	        REP_NUM = REP_URLs.size();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
